<!-- 设置 -->
<template>
  <div class="settings">
    <div class="header">
      <div>
        <el-button type="text" icon="el-icon-arrow-left" style="color: #F4A780; font-size: 16px" @click="goBack">
          <span>设置</span>
        </el-button>
      </div>
      <div class="right">
        <el-button type="text" icon="el-icon-more"></el-button>
        <el-button type="text" icon="el-icon-s-help"></el-button>
      </div>
    </div>
    <div class="content">
      <!-- 账号设置 -->
      <div class="section">
        <div class="section-title">账号设置</div>
        <div class="account-settings">
          <div class="item">
            <div>
              <i class="wechat-icon el-icon-chat-dot-round"></i>
              <span class="label">微信</span>
            </div>
            <span class="status">已绑定</span>
          </div>
          <div class="item">
            <div>
              <i class="phone-icon el-icon-phone"></i>
              <span class="label">手机号</span>
            </div>
            <span class="phone-number">{{this.phone}}</span>
          </div>
        </div>
      </div>
      <!-- 消息设置 -->
      <div class="section">
        <div class="section-title">消息设置</div>
        <div class="message-settings">
          <div class="item">
            <span class="label">接受微信消息推送</span>
            <el-switch v-model="receiveWechatPush"></el-switch>
          </div>
          <div class="item">
            <span class="label">接受短信通知</span>
            <el-switch v-model="receiveSmsNotify"></el-switch>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user: {},
      receiveWechatPush: true,
      receiveSmsNotify: true,
      phone: '',
    }
  },
  methods: {
    goBack() {
      this.$router.go(-1)
    },
    getUserInfo(){
      if (this.token == ''){
        return;
      }
      this.axios.get('http://localhost:9701/web/userInfo/getUserInfo').then(res => {
        this.user = res.data.data;
        this.phone = this.user.phone.substring(0, 3) + '****' + this.user.phone.substring(7);
      })
    }
  },
  created() {
    this.getUserInfo();
  }
}
</script>

<style scoped>
.settings {
  width: 390px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin: 0 10px;
}

.right {
  display: flex;
  border: 1px solid #F4A780;
  padding: 5px 5px;
  border-radius: 15px;
}

.right button {
  color: #F4A780;
  padding: 0 5px;
  font-size: 18px;
}

.content {
  padding-top: 20px;
  border-top: 1px solid #F4A780;
}

.section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: left;
  margin-left: 10px;
}

.wechat-icon {
  color: #1aad19;
  font-size: 20px;
  margin-right: 10px;
}

.phone-icon {
  color: #ff6600;
  font-size: 20px;
  margin-right: 10px;
}

.label {
  font-size: 14px;
}

.status {
  color: #999;
}

.phone-number {
  color: #333;
}

.message-settings, .account-settings {
  margin-left: 10px;
  width: 370px;
  border: 1px solid #F4A780;
}

.item {
  display: flex; /* 将display属性设置为flex */
  justify-content: space-between; /* 子元素平均分布在两边 */
  padding: 18px 20px;
}
</style>